<?php  if ( ! defined('BASE_ROOT')) exit('No direct script access allowed');

if ( ! function_exists('get_ip'))
{
	function get_ip(){
		if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){
			$ipaddr = $_SERVER["HTTP_X_FORWARDED_FOR"];
		}elseif (isset($_SERVER["HTTP_CLIENT_IP"])){
			$ipaddr = $_SERVER["HTTP_CLIENT_IP"];
		}elseif($_SERVER["REMOTE_ADDR"]){
			$ipaddr = $_SERVER["REMOTE_ADDR"];
		}elseif (getenv("HTTP_X_FORWARDED_FOR")){
			$ipaddr = getenv("HTTP_X_FORWARDED_FOR");
		}elseif (getenv("HTTP_CLIENT_IP")){
			$ipaddr = getenv("HTTP_CLIENT_IP");
		}elseif (getenv("REMOTE_ADDR")){
			$ipaddr = getenv("REMOTE_ADDR");
		}else{
			$ipaddr = "Unknown";
		}
		return $ipaddr;
	}
}